<?php

require_once(dirname(__FILE__).'/Constants.php');
require_once(dirname(__FILE__).'/Config.php');
require_once(dirname(__FILE__).'/Util.php');

class DB {
    public function load_dbh () {
        #$db_name = is_devel()
        #    ? DB_NAME_DEVEL
        #    : DB_NAME;
        $db_name = DB_NAME;
        $dbh = mysql_connect(
            DB_HOST,
            DB_USER,
            DB_PASSWORD
        );
        if (!$dbh) {
            trigger_error(mysql_error(), E_USER_WARNING);
            return FALSE;
        }
        $db_selected = mysql_select_db($db_name, $dbh);
        if (!$db_selected) {
            trigger_error(mysql_error(), E_USER_WARNING);
            return FALSE;
        }
        return $dbh;
    }
}
